package types

import (
	"fmt"
	"time"
)

type ParseFunc func(url string) *Response

type Request struct {
	Url string
	ParseFunc ParseFunc
}

type Response struct {
	Requests []*Request
	Contents []interface{}
}

func NewRequest(url string, parseFunc ParseFunc) *Request {
	return &Request{url, parseFunc}
}
func NilParseFunc(_ string) *Response {
	fmt.Println(" I am a nil parse func.")
	return nil
}

type Page struct {
	Url string `json:"url"`
	Title string `json:"title"`
	UserPage string `json:"user_page"`
	UserName string `json:"user_name"`
	Content
}

type Content struct {
	Follow int `json:"follow"`
	Reply int `json:"reply"`
	View int `json:"view"`
	PublishTime time.Time `json:"publish_time"`
}

func NewContent(follow, reply, view int, publishTime time.Time) Content {
	content := Content{
		follow,
		reply,
		view,
		publishTime,
	}
	return content
}